<?php
require_once("include/conn.php");
require_once("include/config.php");

$pagesize=15; //设置每一页显示的记录数

 if(!$page){               //$page是传的页数参数，如果是该参数还没有被传，就设成是1，就是当前页   
          $page=1;   
      }else{   
          if($page<1)   $page=1;   
      }   
      $start   =   ($page-1)*$pagesize;   //   $temp   显示每页的起点（数据库里面的记录起点，比方说从第11条显示）  
	$table='bl_link';	
	
	 $sql   =   "select   *   from   $table  where `isshow`='1' order   by   tdate   DESC   limit   $start,$pagesize";   //从上面的起点开始查询出20条数据   
      $cn_lk   =   mysql_db_query($db_name,$sql);
	  
	     
	  $sql_all   =   "select   *   from   $table  where `isshow`='1' ";
	  $con   =   mysql_db_query($db_name,$sql_all);   
      $num   =   mysql_num_rows($con);   //   统计当前总的记录数   
      $numbers   =   ceil($num/$pagesize);           //总的页数（每页显示n条，当然n你可以自己去改） 


//$sql_lk="select * from $tb_lk where `isshow`='1' ";
//$cn_lk=mysql_query($sql_lk);
?>
<link href="../images/bj.css" rel="stylesheet" type="text/css">	
<STYLE type=text/css>BODY {
	FONT-SIZE: 9pt
}
TABLE {
	FONT-SIZE: 9pt
}
</STYLE>
<?php
		 include("include/top.php"); 
	 		
			?>	
<TABLE width=779 border=0 align="center" cellPadding=0 
cellSpacing=0 borderColor=#111111 id=AutoNumber1 style="BORDER-COLLAPSE: collapse">
  <TBODY>
  <TR>
    <TD>      
      <P align=center><FONT color=#000000><B 
      style="FONT-SIZE: 16pt">友情链接</B></FONT></P>
      <DIV align=center>
      <CENTER>
      <TABLE style="BORDER-COLLAPSE: collapse" borderColor=#336699 height=25 
      cellSpacing=0 cellPadding=2 width=100% border=1>
        <TBODY>
        <TR bgColor=#cccccc>
          <TD width=46 bgColor=#e8e8e8 height=25>序号</TD>
          <TD width=185 bgColor=#e8e8e8 height=12>链接单位名称</TD>
          <TD width=367 bgColor=#e8e8e8 height=12>链接描述</TD>
		  
		  <TD width=155 bgColor=#e8e8e8 height=12>链接地址</TD>
		 	 <?php 
			 $i=1;
		 while($row_lk = mysql_fetch_array($cn_lk)){
		 ?>      
		  </TR>
        <TR>
          <TD ><?php echo $i; ?></TD>
          <TD ><a href="<?php echo $row_lk[url] ?>" target="_blank">
		  <?php echo substr_cut($row_lk[name],26) ?></a> </TD>
    	<td ><?php echo	 substr_cut($row_lk[description],40)?></td>
		<td><?php echo $row_lk[url] ?></td>
		  </TR>
		  <?php 
		   $i++;
		  }?>
		  </TBODY></TABLE>
      </CENTER></DIV>
      <DIV align=center style="line-height:18px;">
	  
	  <?php if($page==1) {?>
          首页
            <?php } else {?> &nbsp;&nbsp; 
            <a   href=?page=1<?php echo $url ?>>首页</a>
			
            <?php }?>&nbsp;&nbsp;
        <?php if($page==1) {?>
          上页
            <?php } else {?> &nbsp;&nbsp; 
            <a   href=?page=<?php   echo $page-1;?><?php echo $url ?>>上页</a>
            <?php }?>
            &nbsp;&nbsp;　 
         <?php if($page==$numbers) {?>
          下页
            <?php } else {?> &nbsp;&nbsp; 
            <a   href=?page=<?php   echo $page+1;?><?php echo $url ?>>下页</a>
            <?php }?>
           &nbsp;&nbsp; 　 
          <?php if($page==$numbers) {?>
          尾页
            <?php } else {?> &nbsp;&nbsp; 
            <a   href=?page=<?php   echo $numbers;?><?php echo $url ?>>尾页</a>
            <?php }?>	 

	  &nbsp;&nbsp;共<?php   echo $num;?>条&nbsp;
	  <?php   echo $pagesize;?>条/每页
	  &nbsp;
	  共<?php   echo $numbers;?>页&nbsp;
	  当前第<?php   echo $page;?>页 
</DIV>
</TD>
</TR>
</TBODY>
</TABLE>	
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
